<template>
    <van-sticky :offset-top="0">
      <div class="header" :style="{backgroundColor: bgColor}">
        <slot name="left"></slot>
        <p>{{ title }}</p>
        <slot name="right"></slot>
      </div>
    </van-sticky>
</template>

<script>
export default {
  name: 'Home',
  props: {
    title: {
      type: String,
      default: () => '外卖'
    },
    bgColor: {
      type: String,
      default: () => '#f18010'
    }
  },
  data() {
    return {}
  }
}
</script>

<style lang="scss" scoped>
@import '@/assets/css/common.scss';

.header {
  height: 40px;
  padding: 0 10px;
  background-color: $activeColor;
  color: $inactiveColor;
  font-size: 18px;
  color: #fff;

  display: flex;
  align-items: center;
  justify-content: space-around;

  p {
    width: 70%;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}
</style>
